import Cookies from 'js-cookie'

const TokenKey = 'userToken'
const UserKey = 'userId'
const AvatarKey = 'userAvatar'
const BranchIDKey = 'branchId'
const BranchNameKey = 'branchName'
export function getToken() {
  return Cookies.get(TokenKey)
}

export function setToken(token) {
  return Cookies.set(TokenKey, token)
}

export function removeToken() {
  return Cookies.remove(TokenKey)
}

export function getAvatar() {
  return Cookies.get(AvatarKey)
}

export function setAvatar(avatar) {
  return Cookies.set(AvatarKey, avatar)
}

export function removeAvatar() {
  return Cookies.remove(AvatarKey)
}

export function getUserId() {
  return Cookies.get(UserKey)
}

export function setUserId(userid) {
  return Cookies.set(UserKey, userid)
}

export function removeUserId() {
  return Cookies.remove(UserKey)
}

export function getBranchId() {
  return Cookies.get(BranchIDKey)
}

export function setBranchId(brandid) {
  return Cookies.set(BranchIDKey, brandid)
}

export function removeBranchId() {
  return Cookies.remove(BranchIDKey)
}

export function getBranchName() {
  return Cookies.get(BranchNameKey)
}

export function setBranchName(brandid) {
  return Cookies.set(BranchNameKey, brandid)
}

export function removeBranchName() {
  return Cookies.remove(BranchNameKey)
}


// 清除所有cookies
export function clearAllCookies() {
  Cookies.remove(TokenKey)
  Cookies.remove(UserKey)
  Cookies.remove(AvatarKey)
  Cookies.remove(BranchIDKey)
  Cookies.remove(BranchNameKey)
}